package com.yuxiao.dynmic.scheduled.example;

import com.yuxiao.dynmic.scheduled.annotation.DynamicScheduled;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

/**
 * @author yangjunwei
 * @date 2022-01-26 22:08
 */
@Slf4j
@Configuration
public class DynamicScheduledDemo {

    /**
     * 动态定时任务显示
     * name : 任务名称或占位符
     * cron : cron表达式或占位符，直接使用cron字符串后，无法做到任务的动态配置
     */
    @DynamicScheduled(name = "${task.name:dynamic-scheduled-demo}", cron = "${task.cron}")
    public void job() {
        log.info(">>>>>>>>>>>>>>>>>>>execute my job");
    }

}
